﻿#include "codeversion.h"

#include <QDebug>

#include "memento.h"

CodeVersion::CodeVersion()
{

}

void CodeVersion::setVersion(int version, QString date, QString label)
{
    m_codeInfo.version = version;
    m_codeInfo.lable = label;
    m_codeInfo.date = date;
}

Memento *CodeVersion::save()
{
    return new Memento(m_codeInfo.version, m_codeInfo.date, m_codeInfo.lable);
}

void CodeVersion::restore(Memento *memento)
{
    m_codeInfo.date = memento->date();
    m_codeInfo.lable = memento->label();
    m_codeInfo.version = memento->version();
}

void CodeVersion::current()
{
    qDebug() << "current" << m_codeInfo.version << ": " << m_codeInfo.date << " " << m_codeInfo.lable;
}
